<?php
include_once('../php/config.php');
$tpl = new TemplatePower( "../views/listaclientes.html" );
$rs = new query();

/*
*  Includes
*/

$tpl->assignInclude( "header", "../inc/top.php" );
$tpl->assignInclude( "footer", "../inc/footer.php" );
/*End*/

$sqlUsuarios = "SELECT * from cliente ";
$rowsUsuarios = DBUtils::getRows($sqlUsuarios);

$sqlConta= "SELECT COUNT(*) as num FROM cliente ";
$num = DBUtils::getRow($sqlConta);

$tpl->prepare();
$tpl->assign('numCli',$num['num']);
$tpl->assign('mensagem','excuido com sucesso!');

if(empty($rowsUsuarios)){
	$tpl->newBlock( "erro" );
}else{
	foreach($rowsUsuarios as $teste){
		 $tpl->newBlock( "clientes" );//carrega o bloco com foreach e seus assigns
         $tpl->assign('nome',$teste['nome']);
		 $tpl->assign('email',$teste['email']);
		 $tpl->assign('rua',$teste['rua']);
		 $tpl->assign('bairro',$teste['bairro']);
		 $tpl->assign('cep',$teste['cep']);
		 $tpl->assign('telefone',$teste['telefone']);
		 $tpl->assign('id',$teste['id_cliente']);
	}
}
$tpl->printToScreen();

?>